/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * NewJFrame.java
 *
 * Created on 10/01/2012, 11:20:06 AM
 */

package holasvn;

import alumnos.ListaDeAlumnos;
import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.Image;
import javax.swing.ImageIcon;
import javax.swing.JOptionPane;

/**
 *
 * @author chesp
 */
public class NewJFrame extends javax.swing.JFrame {

    /** Creates new form NewJFrame */
    public NewJFrame() {
        initComponents();
      setDefaultLookAndFeelDecorated(true);
        setLocationRelativeTo(null);
        setVisible(true);

    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        ventana1 = new javax.swing.JDialog();
        CabezaMininegocio = new java.awt.Label();
        label1 = new java.awt.Label();
        botonagrega = new javax.swing.JButton();
        botonborra = new javax.swing.JButton();
        botonregresa = new javax.swing.JButton();
        jLabel3 = new javax.swing.JLabel();
        labelMuestraAreas = new javax.swing.JLabel();
        ventanaEstandares = new javax.swing.JDialog();
        ventanaintroducemini = new javax.swing.JDialog();
        label2 = new java.awt.Label();
        camponombre = new java.awt.TextField();
        label3 = new java.awt.Label();
        camponumcuenta = new java.awt.TextField();
        label4 = new java.awt.Label();
        campopromedio = new java.awt.TextField();
        regresaMininegocios = new javax.swing.JButton();
        regresamininegocioscancelar = new javax.swing.JButton();
        jLabel1 = new javax.swing.JLabel();
        jLabel2 = new javax.swing.JLabel();
        primerbotonmenu = new javax.swing.JButton();
        jScrollBar1 = new javax.swing.JScrollBar();
        botonEstandares = new javax.swing.JButton();
        botonCheckList = new javax.swing.JButton();
        botonResultados = new javax.swing.JButton();
        botonAcerdaDe = new javax.swing.JButton();
        botonSalirGeneral = new javax.swing.JButton();

        ventana1.setTitle("Mininegocios");
        ventana1.setName("primeraVentana"); // NOI18N
        ventana1.addWindowListener(new java.awt.event.WindowAdapter() {
            public void windowClosing(java.awt.event.WindowEvent evt) {
                ventana1WindowClosing(evt);
            }
        });
        ventana1.addComponentListener(new java.awt.event.ComponentAdapter() {
            public void componentResized(java.awt.event.ComponentEvent evt) {
                ventana1ComponentResized(evt);
            }
        });

        CabezaMininegocio.setName("Seleccione los "); // NOI18N
        CabezaMininegocio.setText("Lista de Mininegocios ");
        CabezaMininegocio.setVisible(false);

        label1.setText("Gestión de Áreas");

        botonagrega.setText("Agregar");
        botonagrega.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                botonagregaActionPerformed(evt);
            }
        });

        botonborra.setText("Borrar");

        botonregresa.setText("Regresar al Menú");
        botonregresa.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                botonregresaActionPerformed(evt);
            }
        });

        jLabel3.setText("Áreas disponibles actualmente:");

        javax.swing.GroupLayout ventana1Layout = new javax.swing.GroupLayout(ventana1.getContentPane());
        ventana1.getContentPane().setLayout(ventana1Layout);
        ventana1Layout.setHorizontalGroup(
            ventana1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(ventana1Layout.createSequentialGroup()
                .addGap(177, 177, 177)
                .addComponent(label1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(343, Short.MAX_VALUE))
            .addGroup(ventana1Layout.createSequentialGroup()
                .addGap(40, 40, 40)
                .addGroup(ventana1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(ventana1Layout.createSequentialGroup()
                        .addComponent(labelMuestraAreas)
                        .addContainerGap())
                    .addGroup(ventana1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addGroup(ventana1Layout.createSequentialGroup()
                            .addComponent(jLabel3)
                            .addContainerGap())
                        .addGroup(ventana1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(ventana1Layout.createSequentialGroup()
                                .addComponent(botonagrega)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 144, Short.MAX_VALUE)
                                .addComponent(botonborra)
                                .addGap(108, 108, 108)
                                .addComponent(botonregresa)
                                .addGap(80, 80, 80))
                            .addGroup(ventana1Layout.createSequentialGroup()
                                .addComponent(CabezaMininegocio, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addContainerGap(592, Short.MAX_VALUE))))))
        );
        ventana1Layout.setVerticalGroup(
            ventana1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(ventana1Layout.createSequentialGroup()
                .addGap(16, 16, 16)
                .addGroup(ventana1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(CabezaMininegocio, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(label1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jLabel3)
                .addGap(26, 26, 26)
                .addComponent(labelMuestraAreas)
                .addGap(90, 90, 90)
                .addGroup(ventana1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(botonagrega)
                    .addComponent(botonregresa)
                    .addComponent(botonborra))
                .addContainerGap(91, Short.MAX_VALUE))
        );

        javax.swing.GroupLayout ventanaEstandaresLayout = new javax.swing.GroupLayout(ventanaEstandares.getContentPane());
        ventanaEstandares.getContentPane().setLayout(ventanaEstandaresLayout);
        ventanaEstandaresLayout.setHorizontalGroup(
            ventanaEstandaresLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 400, Short.MAX_VALUE)
        );
        ventanaEstandaresLayout.setVerticalGroup(
            ventanaEstandaresLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 300, Short.MAX_VALUE)
        );

        ventanaintroducemini.setTitle("HAPSIE - Introduce Mininegocios");

        label2.setText("Introduzca nombre del alumno:");

        label3.setText("Introduzca número de cuenta:");

        label4.setText("Introduzca promedio:");

        campopromedio.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                campopromedioActionPerformed(evt);
            }
        });

        regresaMininegocios.setText("Save");

        regresamininegocioscancelar.setText("Cancel");

        javax.swing.GroupLayout ventanaintroduceminiLayout = new javax.swing.GroupLayout(ventanaintroducemini.getContentPane());
        ventanaintroducemini.getContentPane().setLayout(ventanaintroduceminiLayout);
        ventanaintroduceminiLayout.setHorizontalGroup(
            ventanaintroduceminiLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(ventanaintroduceminiLayout.createSequentialGroup()
                .addGap(91, 91, 91)
                .addGroup(ventanaintroduceminiLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(label3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGroup(ventanaintroduceminiLayout.createSequentialGroup()
                        .addGroup(ventanaintroduceminiLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(ventanaintroduceminiLayout.createSequentialGroup()
                                .addComponent(label4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addGap(111, 111, 111))
                            .addGroup(ventanaintroduceminiLayout.createSequentialGroup()
                                .addGroup(ventanaintroduceminiLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                                    .addComponent(campopromedio, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 198, Short.MAX_VALUE)
                                    .addComponent(camponumcuenta, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 198, Short.MAX_VALUE)
                                    .addComponent(camponombre, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 198, Short.MAX_VALUE)
                                    .addComponent(label2, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                                .addGap(49, 49, 49)))
                        .addGap(12, 12, 12)
                        .addGroup(ventanaintroduceminiLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addComponent(regresaMininegocios, javax.swing.GroupLayout.PREFERRED_SIZE, 68, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(regresamininegocioscancelar))
                        .addGap(25, 25, 25)))
                .addContainerGap())
        );
        ventanaintroduceminiLayout.setVerticalGroup(
            ventanaintroduceminiLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(ventanaintroduceminiLayout.createSequentialGroup()
                .addGap(24, 24, 24)
                .addComponent(label2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(camponombre, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(28, 28, 28)
                .addComponent(label3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addGroup(ventanaintroduceminiLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                    .addGroup(ventanaintroduceminiLayout.createSequentialGroup()
                        .addComponent(regresamininegocioscancelar)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addComponent(regresaMininegocios))
                    .addGroup(ventanaintroduceminiLayout.createSequentialGroup()
                        .addComponent(camponumcuenta, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(30, 30, 30)
                        .addComponent(label4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(19, 19, 19)
                        .addComponent(campopromedio, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap(59, Short.MAX_VALUE))
        );

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setTitle("HAPSIE01.0");
        setFont(new java.awt.Font("DejaVu Sans Mono", 0, 10));

        jLabel1.setText("MENÚ");

        jLabel2.setText("Negotegia ( logo )");

        primerbotonmenu.setText("Gestión de Areas");
        primerbotonmenu.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                primerbotonmenuActionPerformed(evt);
            }
        });

        botonEstandares.setText("Gestión de Estándares");
        botonEstandares.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                botonEstandaresActionPerformed(evt);
            }
        });

        botonCheckList.setText("CheckList");

        botonResultados.setText("Resultados");

        botonAcerdaDe.setText("Acerca de..");

        botonSalirGeneral.setText("Salir");
        botonSalirGeneral.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                botonSalirGeneralActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addGap(208, 208, 208)
                        .addComponent(jLabel1))
                    .addGroup(layout.createSequentialGroup()
                        .addGap(147, 147, 147)
                        .addComponent(botonEstandares))
                    .addGroup(layout.createSequentialGroup()
                        .addGap(165, 165, 165)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(primerbotonmenu)
                            .addComponent(jLabel2)))
                    .addGroup(layout.createSequentialGroup()
                        .addGap(195, 195, 195)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                            .addComponent(botonSalirGeneral, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(botonCheckList, javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(botonResultados, javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(botonAcerdaDe, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 176, Short.MAX_VALUE)
                .addComponent(jScrollBar1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGap(35, 35, 35)
                .addComponent(jLabel2)
                .addGap(34, 34, 34)
                .addComponent(jLabel1)
                .addGap(36, 36, 36)
                .addComponent(primerbotonmenu)
                .addGap(18, 18, 18)
                .addComponent(botonEstandares)
                .addGap(18, 18, 18)
                .addComponent(botonCheckList)
                .addGap(18, 18, 18)
                .addComponent(botonResultados)
                .addGap(18, 18, 18)
                .addComponent(botonAcerdaDe)
                .addGap(31, 31, 31)
                .addComponent(botonSalirGeneral)
                .addGap(96, 96, 96))
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addGap(24, 24, 24)
                .addComponent(jScrollBar1, javax.swing.GroupLayout.DEFAULT_SIZE, 496, Short.MAX_VALUE))
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void primerbotonmenuActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_primerbotonmenuActionPerformed
   // jScrollBar1.setPreferredSize(new Dimension(450,110));
   // add(jScrollBar1, BorderLayout.CENTER);
        
        ventana1.setVisible(true);
        setVisible(false);
        ventana1.setSize(new Dimension(500,500));
        // TODO add your handling code here:
      
        ventana1.setLocationRelativeTo(null);

    }//GEN-LAST:event_primerbotonmenuActionPerformed

    private void ventana1ComponentResized(java.awt.event.ComponentEvent evt) {//GEN-FIRST:event_ventana1ComponentResized
        // TODO add your handling code here:

        //no sé para que sirven

    }//GEN-LAST:event_ventana1ComponentResized

    private void ventana1WindowClosing(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_ventana1WindowClosing
    setVisible(true);
   ventana1.setDefaultLookAndFeelDecorated(true);


      
     int response = JOptionPane.showConfirmDialog(ventana1, "Deseas Guardar todos los cambios", "AVISO!!", JOptionPane.WARNING_MESSAGE);

   if (response == JOptionPane.NO_OPTION) {
     ventana1.setVisible(true);
    } else if (response == JOptionPane.YES_OPTION) {
   ventana1.dispose();
   this.setVisible(true);
    } else if (response == JOptionPane.CLOSED_OPTION) {
      System.out.println("JOptionPane closed");
    }

     ListaDeAlumnos lista = new ListaDeAlumnos();
      lista.meteUno();

     labelMuestraAreas.setText(lista.toString());
    //ventana1.setVisible(false); //cierra la ventana al apretar la cruz

    }//GEN-LAST:event_ventana1WindowClosing

    private void botonregresaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_botonregresaActionPerformed
    ventana1.dispose();

   this.setVisible(true);

    }//GEN-LAST:event_botonregresaActionPerformed

    private void botonSalirGeneralActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_botonSalirGeneralActionPerformed
   System.exit(0); //Salimos de la llamada al sistema
    }//GEN-LAST:event_botonSalirGeneralActionPerformed

    private void botonEstandaresActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_botonEstandaresActionPerformed
       ventanaEstandares.setVisible(true);
       setVisible(false);
    }//GEN-LAST:event_botonEstandaresActionPerformed

    private void botonagregaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_botonagregaActionPerformed
         ventanaintroducemini.setVisible(true);
         ventanaintroducemini.setSize(new Dimension(500,500));
         ventanaintroducemini.setLocationRelativeTo(ventana1);




    }//GEN-LAST:event_botonagregaActionPerformed

    private void campopromedioActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_campopromedioActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_campopromedioActionPerformed

    /**
    * @param args the command line arguments
    */
    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new NewJFrame().setVisible(true);
            }
        });
    }

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private java.awt.Label CabezaMininegocio;
    private javax.swing.JButton botonAcerdaDe;
    private javax.swing.JButton botonCheckList;
    private javax.swing.JButton botonEstandares;
    private javax.swing.JButton botonResultados;
    private javax.swing.JButton botonSalirGeneral;
    private javax.swing.JButton botonagrega;
    private javax.swing.JButton botonborra;
    private javax.swing.JButton botonregresa;
    private java.awt.TextField camponombre;
    private java.awt.TextField camponumcuenta;
    private java.awt.TextField campopromedio;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JScrollBar jScrollBar1;
    private java.awt.Label label1;
    private java.awt.Label label2;
    private java.awt.Label label3;
    private java.awt.Label label4;
    private javax.swing.JLabel labelMuestraAreas;
    private javax.swing.JButton primerbotonmenu;
    private javax.swing.JButton regresaMininegocios;
    private javax.swing.JButton regresamininegocioscancelar;
    private javax.swing.JDialog ventana1;
    private javax.swing.JDialog ventanaEstandares;
    private javax.swing.JDialog ventanaintroducemini;
    // End of variables declaration//GEN-END:variables

}
